
if exists (select 1 from sysobjects where name = 'upd_person' and type = 'P')
begin
   drop procedure upd_person
   print 'Procedure: upd_person deleted ...'
end
go

create procedure upd_person(
  @vorname         varchar(32) = 'name test', 
  @nachname        varchar(32) = 'nachname', 
  @strasse         varchar(32) = 'strasse', 
  @strassennr      varchar(5)  = 'nr', 
  @postfach        varchar(10) = 'postfach test', 
  @plz             char(5)     = 'plz', 
  @ort             varchar(32) = 'ort', 
  @telnrp          varchar(15) = 'telp', 
  @telnrn          varchar(15) = 'teln', 
  @email           varchar(60) = 'email@email.ch',
  --@pensumvon       varchar(8)   = '20070301',--datetime    = '20070301',
  --@pensumbis       varchar(8)    = '20100101',--datetime    = '20100101',
  --@pensumprozent   smallint    = 100,
  --@anstellungid    int         = 1,
  @prsid           int         = 3
)
as
begin
  set nocount on


   update Person set
          Person.Vorname = @vorname,
          Person.Nachname = @nachname,
          Person.Strasse = @strasse,
          Person.Strassennr = @strassennr,
          Person.Postfach = @postfach,
          Person.PLZ = @plz,
          Person.Ort = @ort,
          Person.TelnrP = @telnrp,
          Person.TelnrN = @telnrn,
          Person.Email = @email
    where Person.PrsId = @prsid


end
go
print 'Procedure: upd_person done ...'
go
grant exec on upd_person to prsadmins with grant option
go
grant exec on upd_person to prsusers
go

